Bitwise Left Shift (<<) Operator in C++
C++
#include <iostream> using namespace std; int main() { int x = 5; int y = x << 2; cout << "Value of x after left shift by 2 positions: " << y << endl; return 0; } |
Output
Value of x after left shift by 2 positions: 20
Bitwise Left Shift(<<) Operator in Programming
Bitwise operators play a significant role in manipulating individual bits within binary data. Among these operators, the Bitwise Left Shift (<<) operator is used for shifting the bits of a number to the left by a specified number of positions. In this blog post, we’ll explore the definition, syntax, examples, and optimization techniques associated with the bitwise left shift operator.
Table of Content
- What is Bitwise Left Shift (<<) Operator
- Bitwise Left Shift (<<) Operator Syntax
- Bitwise Left Shift (<<) Operator in C
- Bitwise Left Shift (<<) Operator in C++
- Bitwise Left Shift (<<) Operator in Java
- Bitwise Left Shift (<<) Operator in Python
- Bitwise Left Shift (<<) Operator in C#
- Bitwise Left Shift (<<) Operator in Javascript
- Bitwise Left Shift (<<) Operator Use Cases
Contact Us